package cn.edu.sdjzu.xg.bysj.service;

import cn.edu.sdjzu.xg.bysj.dao.DepartmentDao;
import cn.edu.sdjzu.xg.bysj.domain.Condition;
import cn.edu.sdjzu.xg.bysj.domain.Department;
import cn.edu.sdjzu.xg.bysj.domain.Pagination;
import cn.edu.sdjzu.xg.bysj.exception.BysjException;

import java.sql.SQLException;
import java.util.Collection;
import java.util.List;

public class DepartmentService {
    private DepartmentService(){}
    private static Department department = null;
    private static DepartmentService departmentService = null;

    public static DepartmentService getInstance() throws SQLException {
        if(departmentService == null){
            departmentService = new DepartmentService();
        }
        return departmentService;
    }
    public Department find(int id) throws SQLException {
        Department department = DepartmentDao.getInstance().find(id);
        return department;
    }
    public Collection<Department> findAll(List<Condition> conditionList, Pagination pagination) throws SQLException, BysjException {
        return DepartmentDao.getInstance().findAll();
    }
    public Collection<Department> findAll() throws SQLException, BysjException {
        return DepartmentDao.getInstance().findAll();
    }
}
